package way.scripts.classDoc.segment;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Haozhiqiang  {2021/12/7 14:34}
 */
public abstract class AbstractNode {

    private String parentIndex;
    private int selfIndex;


    public abstract int getLevel();

    public void setSelfIndex(int selfIndex) {
        this.selfIndex = selfIndex;
    }

    public void setParentIndex(String parentIndex) {
        this.parentIndex = parentIndex;
    }

    public String getDocIndex() {
        if (StringUtils.isEmpty(parentIndex)) {
            return String.valueOf(selfIndex);
        } else {
            return this.parentIndex + "." + selfIndex;
        }
    }
}
